package rm.download;

import rm.utils.HttpDownloader;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class Download extends Activity {
    /** Called when the activity is first created. */
	private Button downloadTxtButton;
    private Button downloadMp3Button;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        downloadTxtButton = (Button) findViewById(R.id.downloadTxtButton);
        downloadMp3Button = (Button) findViewById(R.id.downloadMp3Button);
        downloadTxtButton.setOnClickListener(new DownloadTxtListener());
        downloadMp3Button.setOnClickListener(new DownloadMp3Listener());
    }
    class DownloadTxtListener implements OnClickListener{

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			HttpDownloader httpDownloder = new HttpDownloader();
			String lrc = httpDownloder.download("http://www.51lrcgc.com/asp/lrc.asp?id=20030225LjICd6");
			System.out.println(lrc);
		}
    	
    }
    
    class DownloadMp3Listener implements OnClickListener{

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			HttpDownloader httpDownloder = new HttpDownloader();
			int result = httpDownloder.downFile("http://www.51lrcgc.com/asp/lrc.asp?id=20030225LjICd6","voa/","a1.mp3");
			System.out.println(result);
		}
    	
    }
}